package com.estate.common.enums;

import com.estate.common.constant.Constants;
import lombok.Getter;

/**
 * 用户状态
 *
 * @author ruoyi
 */
@Getter
public enum RoleTagEnum {
    ADMIN("admin", Constants.DATA_SCOPE_ALL),
    BOSS("boss", Constants.DATA_SCOPE_ALL),
    DATA_OPERATOR("data_operator", Constants.DATA_SCOPE_DEPT_AND_CHILD),
    SALES("sales", Constants.DATA_SCOPE_SELF),
    SALES_TEAM_LEADER("sales_team_leader", Constants.DATA_SCOPE_DEPT_AND_CHILD),
    SALES_MANAGER("sales_manager", Constants.DATA_SCOPE_DEPT_AND_CHILD),
    LEASING_AGENT("leasing_agent", Constants.DATA_SCOPE_SELF),
    PM_TEAM_LEADER("pm_team_leader", Constants.DATA_SCOPE_DEPT_AND_CHILD),
    PROPERTY_MANAGER("property_manager", Constants.DATA_SCOPE_DEPT_AND_CHILD),
    BUSINESS_DEVELOPER_MANAGER("business_developer_manager", Constants.DATA_SCOPE_DEPT_AND_CHILD),
    BUSINESS_DEVELOPER("business_developer", Constants.DATA_SCOPE_SELF),
    OTHER("other", Constants.DATA_SCOPE_SELF),
    ;

    private final String tag;

    private final String dataScope;

    RoleTagEnum(String tag, String dataScope) {
        this.tag = tag;
        this.dataScope = dataScope;
    }

    public static String getDataScopeByTag(String tag) {
        for (RoleTagEnum value : RoleTagEnum.values()) {
            if (value.getTag().equals(tag)) {
                return value.getDataScope();
            }
        }
        return Constants.DATA_SCOPE_SELF;
    }
}
